package com.cbd.pojo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.*;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;

import com.fasterxml.jackson.annotation.JsonBackReference;

/**
 * @author One 出租信息
 */
@Entity
@Table(name = "rentInfo")
@Validated
public class RentInfo implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "rentInfoID")
	private int rentInfoID;
	/**
	 * 开始日期
	 * 
	 */
	@Column(name = "startTime")
	private Date startTime;
	/**
	 * 发布租车 日期
	 * 
	 */
	@Column(name = "createTime")
	private Date createTime;
	/**
	 * 出租价格
	 * 
	 */
	@Column(name = "price")
	private BigDecimal price;
	/**
	 * 结束日期
	 * 
	 */
	@Column(name = "endTime")
	private Date endTime;

	/**
	 * 租车意向
	 */
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "rentInfo")
	private List<Purpose> purposes;
	/**
	 * 个人车位
	 */
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "carportID")
	private Personalcarport personalcarport;

	/**
	 * 一条发布租车信息  每次发布租车信息就会产生一条
	 *  1 ：车位被租合同未到期   0：到期设置
	 */
	@Column(name = "type")
	private boolean type;

	public int getRentInfoID() {
		return rentInfoID;
	}

	public void setRentInfoID(int rentInfoID) {
		this.rentInfoID = rentInfoID;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public List<Purpose> getPurposes() {
		return purposes;
	}

	public void setPurposes(List<Purpose> purposes) {
		this.purposes = purposes;
	}

	public Personalcarport getPersonalcarport() {
		return personalcarport;
	}

	public void setPersonalcarport(Personalcarport personalcarport) {
		this.personalcarport = personalcarport;
	}

	public boolean isType() {
		return type;
	}

	public void setType(boolean type) {
		this.type = type;
	}

}